//package cn.iocoder.yudao.framework.i18n.config;
//
//import jakarta.servlet.http.HttpServletRequest;
//import jakarta.servlet.http.HttpServletResponse;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.boot.autoconfigure.AutoConfiguration;
//import org.springframework.context.annotation.Bean;
//
//import org.springframework.util.StringUtils;
//import org.springframework.web.servlet.LocaleResolver;
//
//import java.util.Locale;
//
///**
// * @author Eric
// */
//@Slf4j
//@AutoConfiguration
//public class I18nLocaleResolver implements LocaleResolver {
//
//    @Override
//    public Locale resolveLocale(HttpServletRequest request) {
//        String lang = request.getParameter("Accept-Language");
//        String header = request.getHeader("Accept-Language");
//
//        Locale locale = null;
//        if (!StringUtils.isEmpty(lang)) {
//            String[] split = lang.split("_");
//            locale = new Locale(split[0], split[1]);
//        } else if (!StringUtils.isEmpty(header)) {
//            header = header.replaceAll("\"", "");
//            String[] split = header.split("_");
//            locale = new Locale(split[0], split[1]);
////        } else {
////            // 获取jvm默认locale
////            locale = Locale.getDefault();
//        }
//        return locale;
//    }
//
//    @Override
//    public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) {
//
//    }
//
//}